package ade.prime.activity;

import ade.prime.model.AdeWebOptions;
import ade.prime.model.AdeWebOptions.PreferenceReplicator;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceManager;

import com.actionbarsherlock.app.SherlockPreferenceActivity;

public class SyncPreference extends SherlockPreferenceActivity {
	
	protected OnSharedPreferenceChangeListener listener ;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    	this.setTheme(AdeWebOptions.getTheme(this)) ;
        //Change l'icone de la barre d'action
        this.getSupportActionBar().setIcon(R.drawable.ic_launch_settings) ;
        super.onCreate(savedInstanceState) ;

        this.addPreferencesFromResource(R.xml.sync_preferences) ;
        this.listener = new PreferenceReplicator(this) ;
        PreferenceManager.getDefaultSharedPreferences(this)
        	.registerOnSharedPreferenceChangeListener(this.listener) ;
    }// onCreate(Bundle)
    
    /**
     * {@inheritDoc}
     */
    @Override
    protected void onDestroy() {
    	super.onDestroy() ;
    	PreferenceManager.getDefaultSharedPreferences(this)
    		.unregisterOnSharedPreferenceChangeListener(this.listener) ;
    }// onDestroy()
    
}// class SyncPreference